package com.forlove.app.qselect.login.entity;

import com.forlove.app.common.base.mvp.entity.BaseEntity;
import com.forlove.app.common.base.serializer.JSONKey;
import com.forlove.app.common.utils.StringUtils;
import com.forlove.app.qselect.login.widget.pickerview.model.IPickerViewData;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by yjl on 2017/11/21.
 */

public class SchoolInfoEntity extends BaseEntity implements IPickerViewData {
    @JSONKey(keys = "id", type = Integer.class)
    public int id;

    @JSONKey(type = Long.class, keys = "lat")
    public long lat;

    @JSONKey(keys = "lng", type = Long.class)
    public long lng;

    @JSONKey(type = String.class, keys = "school")
    public String school;

    @JSONKey(keys = "yuanxi", type = String.class)
    public String yuanxi;

    private List<String> academic = new ArrayList<>(); //学院

    public List<String> getAcademic() {
        if (academic.size() > 0) {
            return academic;
        } else if (StringUtils.isNotEmpty(yuanxi)) {
            String[] acdeStr = yuanxi.split(",");
            academic.clear();
            for (String yx : acdeStr) {
                academic.add(yx);
            }
        }
        return academic;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public long getLat() {
        return lat;
    }

    public void setLat(long lat) {
        this.lat = lat;
    }

    public long getLng() {
        return lng;
    }

    public void setLng(long lng) {
        this.lng = lng;
    }

    public String getSchool() {
        return school;
    }

    public void setSchool(String school) {
        this.school = school;
    }

    public String getYuanxi() {
        return yuanxi;
    }

    public void setYuanxi(String yuanxi) {
        this.yuanxi = yuanxi;
    }

    @Override
    public String getPickerViewText() {
        return school;
    }

    public SchoolInfoEntity(int id, long lat, long lng, String school, String yuanxi, List<String> academic) {
        this.id = id;
        this.lat = lat;
        this.lng = lng;
        this.school = school;
        this.yuanxi = yuanxi;
        this.academic = academic;
    }

    public SchoolInfoEntity(SchoolInfoEntity schoolInfoEntity) {
        this.id = schoolInfoEntity.id;
        this.lat = schoolInfoEntity.lat;
        this.lng = schoolInfoEntity.lng;
        this.school = schoolInfoEntity.school;
        this.yuanxi = schoolInfoEntity.yuanxi;
        this.academic = schoolInfoEntity.academic;
    }

    public SchoolInfoEntity() {
    }
}
